\(\int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx\) [9]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 33 \[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=-\frac {1}{3 (1+\cos (3 x))}-\frac {1}{3} \log (\cos (3 x))+\frac {1}{3} \log (1+\cos (3 x)) \]

[Out]

-1/3/(1+cos(3*x))-1/3*ln(cos(3*x))+1/3*ln(1+cos(3*x))

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {2786, 46} \[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=-\frac {1}{3 (\cos (3 x)+1)}-\frac {1}{3} \log (\cos (3 x))+\frac {1}{3} \log (\cos (3 x)+1) \]

[In]

Int[Tan[3*x]/(1 + Cos[3*x])^2,x]

[Out]

-1/3*1/(1 + Cos[3*x]) - Log[Cos[3*x]]/3 + Log[1 + Cos[3*x]]/3

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 2786

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/f, Subst[I
nt[x^p*((a + x)^(m - (p + 1)/2)/(a - x)^((p + 1)/2)), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& EqQ[a^2 - b^2, 0] && IntegerQ[(p + 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\left (\frac {1}{3} \text {Subst}\left (\int \frac {1}{x (1+x)^2} \, dx,x,\cos (3 x)\right )\right ) \\ & = -\left (\frac {1}{3} \text {Subst}\left (\int \left (\frac {1}{-1-x}+\frac {1}{x}-\frac {1}{(1+x)^2}\right ) \, dx,x,\cos (3 x)\right )\right ) \\ & = -\frac {1}{3 (1+\cos (3 x))}-\frac {1}{3} \log (\cos (3 x))+\frac {1}{3} \log (1+\cos (3 x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.48 \[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=\frac {-2 \cos ^2\left (\frac {3 x}{2}\right )+\cos ^4\left (\frac {3 x}{2}\right ) \left (8 \log \left (\cos \left (\frac {3 x}{2}\right )\right )-4 \log (\cos (3 x))\right )}{3 (1+\cos (3 x))^2} \]

[In]

Integrate[Tan[3*x]/(1 + Cos[3*x])^2,x]

[Out]

(-2*Cos[(3*x)/2]^2 + Cos[(3*x)/2]^4*(8*Log[Cos[(3*x)/2]] - 4*Log[Cos[3*x]]))/(3*(1 + Cos[3*x])^2)

Maple [A] (verified)

Time = 0.95 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.85

method result size
derivativedivides \(-\frac {1}{3 \left (1+\cos \left (3 x \right )\right )}-\frac {\ln \left (\cos \left (3 x \right )\right )}{3}+\frac {\ln \left (1+\cos \left (3 x \right )\right )}{3}\) \(28\)
default \(-\frac {1}{3 \left (1+\cos \left (3 x \right )\right )}-\frac {\ln \left (\cos \left (3 x \right )\right )}{3}+\frac {\ln \left (1+\cos \left (3 x \right )\right )}{3}\) \(28\)
risch \(-\frac {2 \,{\mathrm e}^{3 i x}}{3 \left ({\mathrm e}^{3 i x}+1\right )^{2}}+\frac {2 \ln \left ({\mathrm e}^{3 i x}+1\right )}{3}-\frac {\ln \left ({\mathrm e}^{6 i x}+1\right )}{3}\) \(38\)

[In]

int(tan(3*x)/(1+cos(3*x))^2,x,method=_RETURNVERBOSE)

[Out]

-1/3/(1+cos(3*x))-1/3*ln(cos(3*x))+1/3*ln(1+cos(3*x))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.30 \[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=-\frac {{\left (\cos \left (3 \, x\right ) + 1\right )} \log \left (-\cos \left (3 \, x\right )\right ) - {\left (\cos \left (3 \, x\right ) + 1\right )} \log \left (\frac {1}{2} \, \cos \left (3 \, x\right ) + \frac {1}{2}\right ) + 1}{3 \, {\left (\cos \left (3 \, x\right ) + 1\right )}} \]

[In]

integrate(tan(3*x)/(1+cos(3*x))^2,x, algorithm="fricas")

[Out]

-1/3*((cos(3*x) + 1)*log(-cos(3*x)) - (cos(3*x) + 1)*log(1/2*cos(3*x) + 1/2) + 1)/(cos(3*x) + 1)

Sympy [F]

\[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=\int \frac {\tan {\left (3 x \right )}}{\left (\cos {\left (3 x \right )} + 1\right )^{2}}\, dx \]

[In]

integrate(tan(3*x)/(1+cos(3*x))**2,x)

[Out]

Integral(tan(3*x)/(cos(3*x) + 1)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.82 \[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=-\frac {1}{3 \, {\left (\cos \left (3 \, x\right ) + 1\right )}} + \frac {1}{3} \, \log \left (\cos \left (3 \, x\right ) + 1\right ) - \frac {1}{3} \, \log \left (\cos \left (3 \, x\right )\right ) \]

[In]

integrate(tan(3*x)/(1+cos(3*x))^2,x, algorithm="maxima")

[Out]

-1/3/(cos(3*x) + 1) + 1/3*log(cos(3*x) + 1) - 1/3*log(cos(3*x))

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.85 \[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=-\frac {1}{3 \, {\left (\cos \left (3 \, x\right ) + 1\right )}} + \frac {1}{3} \, \log \left (\cos \left (3 \, x\right ) + 1\right ) - \frac {1}{3} \, \log \left ({\left | \cos \left (3 \, x\right ) \right |}\right ) \]

[In]

integrate(tan(3*x)/(1+cos(3*x))^2,x, algorithm="giac")

[Out]

-1/3/(cos(3*x) + 1) + 1/3*log(cos(3*x) + 1) - 1/3*log(abs(cos(3*x)))

Mupad [B] (verification not implemented)

Time = 14.14 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.61 \[ \int \frac {\tan (3 x)}{(1+\cos (3 x))^2} \, dx=-\frac {\ln \left ({\mathrm {tan}\left (\frac {3\,x}{2}\right )}^2-1\right )}{3}-\frac {{\mathrm {tan}\left (\frac {3\,x}{2}\right )}^2}{6} \]

[In]

int(tan(3*x)/(cos(3*x) + 1)^2,x)

[Out]

- log(tan((3*x)/2)^2 - 1)/3 - tan((3*x)/2)^2/6